package com.fenghongzhang.lib_core.base

import android.os.Bundle
import android.os.PersistableBundle
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.fenghongzhang.lib_core.R
import com.gyf.immersionbar.ImmersionBar

abstract class BaseActivity<VM : BaseViewModel, VDB : ViewDataBinding> : AppCompatActivity() {

    abstract val mViewModel: VM
    protected lateinit var mBinding: VDB
    abstract val mLayoutResId: Int
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = DataBindingUtil.setContentView(this, mLayoutResId)
        initView()
        initStatusBar()
        initListener()
        initData()



    }

    open fun initView() {
    }
    //初始化状态栏
    protected open fun initStatusBar() {
        ImmersionBar.with(this).init()
    }
    abstract fun initListener()

    abstract fun initData()
}